﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<dynamic>" %>
<%@ Import Namespace="System.Globalization" %>
<%@ Import Namespace="CRM.Resourses" %>
<%@ Import Namespace="DevExpress.Data" %>


<% Html.DevExpress().GridView(settings =>
                                   {
                                       settings.Name = "gdTurnovers";
                                       settings.SettingsPager.PageSize = 20;
                                       settings.KeyFieldName = "IdTurnover";
                                       settings.CallbackRouteValues = new { Controller = "Test", Action = "TurnoversFullListPartion" };
                                       settings.Settings.ShowFilterBar = GridViewStatusBarMode.Visible;
                                       
                                     //  settings.Columns
                                       

                                       settings.Settings.ShowFilterRow = true;
                                       settings.Settings.ShowGroupPanel = true;


                                      


                                       settings.TotalSummary.Add(SummaryItemType.Sum, "Amount").DisplayFormat = Resourses.Total+": {0:c}";
                                       

                                       settings.GroupSummary.Add(SummaryItemType.Sum, "Amount").DisplayFormat   = Resourses.Total+": {0:c}";

                                       settings.CustomColumnDisplayText = (sender, e) =>
                                       {

                                           if (e.Column.FieldName == "Amount")
                                           {


                                               e.DisplayText = ((float)e.Value).ToString("c", CultureInfo.CreateSpecificCulture("fr-FR"));



                                           }
                                       };
                                       settings.SummaryDisplayText = (sender, e) =>
                                       {
                                           if (e.Item.FieldName == "Amount")
                                           {
                                               decimal value;
                                               decimal.TryParse(e.Value.ToString(), out value);
                                               e.Text = Resourses.Total+": " + value.ToString("c", CultureInfo.CreateSpecificCulture("fr-FR"));
                                              // e.Text = value.ToString("euro", null);
                                           }
                                       };
                                       
                                      

                                       
                                       settings.SettingsEditing.Mode = GridViewEditingMode.EditFormAndDisplayRow;
                                       settings.Width = Unit.Percentage(100);
                                       settings.Settings.ShowFooter = true;
                                       settings.PreRender = (sender, e) =>
                                       {
                                           MVCxGridView gridView = sender as MVCxGridView;
                                           if (gridView != null)
                                               gridView.FilterExpression = "Year > 2011";
                                       };
                                       //конец комбобокса
                                   }
        ).Bind(Model).GetHtml();
%>